package view.balance;

import java.awt.event.ActionListener;

import javax.swing.JPanel;
import javax.swing.SpringLayout;
import javax.swing.JLabel;
import javax.swing.JComboBox;
import javax.swing.JButton;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;

public class BalanceReport extends JPanel{
	private JButton lblClick;
	private JButton lblClick_1;
	private JComboBox sellercomboBox;
	private JTable table;
	private JButton btnApplyFilter;
	public BalanceReport() {
		SpringLayout springLayout = new SpringLayout();
		setLayout(springLayout);
		
		JLabel lblDate = new JLabel("FROM DATE:");
		springLayout.putConstraint(SpringLayout.NORTH, lblDate, 24, SpringLayout.NORTH, this);
		springLayout.putConstraint(SpringLayout.WEST, lblDate, 35, SpringLayout.WEST, this);
		add(lblDate);
		
		JLabel lblToDate = new JLabel("TO DATE:");
		springLayout.putConstraint(SpringLayout.NORTH, lblToDate, 0, SpringLayout.NORTH, lblDate);
		springLayout.putConstraint(SpringLayout.WEST, lblToDate, 94, SpringLayout.EAST, lblDate);
		add(lblToDate);
		
		lblClick = new JButton("CLICK");
		lblClick.setActionCommand("CLICK");
		springLayout.putConstraint(SpringLayout.WEST, lblClick, 6, SpringLayout.EAST, lblDate);
		springLayout.putConstraint(SpringLayout.SOUTH, lblClick, 0, SpringLayout.SOUTH, lblDate);
		add(lblClick);
		
		lblClick_1 = new JButton("CLICK");
		lblClick_1.setActionCommand("CLICK");
		springLayout.putConstraint(SpringLayout.NORTH, lblClick_1, 0, SpringLayout.NORTH, lblDate);
		springLayout.putConstraint(SpringLayout.WEST, lblClick_1, 6, SpringLayout.EAST, lblToDate);
		add(lblClick_1);
		
		JLabel lblSellerName = new JLabel("SELLER NAME:");
		springLayout.putConstraint(SpringLayout.NORTH, lblSellerName, 18, SpringLayout.SOUTH, lblDate);
		springLayout.putConstraint(SpringLayout.WEST, lblSellerName, 0, SpringLayout.WEST, lblDate);
		add(lblSellerName);
		
		sellercomboBox = new JComboBox();
		springLayout.putConstraint(SpringLayout.NORTH, sellercomboBox, 15, SpringLayout.SOUTH, lblToDate);
		springLayout.putConstraint(SpringLayout.WEST, sellercomboBox, 11, SpringLayout.EAST, lblSellerName);
		springLayout.putConstraint(SpringLayout.EAST, sellercomboBox, 103, SpringLayout.EAST, lblSellerName);
		add(sellercomboBox);
		
		btnApplyFilter = new JButton("APPLY FILTER");
		btnApplyFilter.setActionCommand("APPLY FILTER");
		springLayout.putConstraint(SpringLayout.NORTH, btnApplyFilter, 14, SpringLayout.SOUTH, sellercomboBox);
		springLayout.putConstraint(SpringLayout.WEST, btnApplyFilter, 129, SpringLayout.WEST, this);
		add(btnApplyFilter);
		
		JScrollPane scrollPane = new JScrollPane();
		springLayout.putConstraint(SpringLayout.NORTH, scrollPane, 19, SpringLayout.SOUTH, btnApplyFilter);
		springLayout.putConstraint(SpringLayout.WEST, scrollPane, 10, SpringLayout.WEST, this);
		springLayout.putConstraint(SpringLayout.SOUTH, scrollPane, 300, SpringLayout.SOUTH, btnApplyFilter);
		springLayout.putConstraint(SpringLayout.EAST, scrollPane, 565, SpringLayout.WEST, this);
		add(scrollPane);
		
		table = new JTable();
		table.setModel(new DefaultTableModel(
			new Object[][] {
			},
			new String[] {
				"SELLER NAME", "PURCHASE DATE", "TOTAL AMOUNT", "AMOUNT PAID", "BALANCE"
			}
		) {
			boolean[] columnEditables = new boolean[] {
				false, false, false, false, true
			};
			public boolean isCellEditable(int row, int column) {
				return columnEditables[column];
			}
		});
		table.getColumnModel().getColumn(0).setPreferredWidth(103);
		table.getColumnModel().getColumn(1).setPreferredWidth(111);
		table.getColumnModel().getColumn(2).setPreferredWidth(107);
		table.getColumnModel().getColumn(3).setPreferredWidth(99);
		scrollPane.setViewportView(table);
	}
	
	public JButton getLblClick() {
		return lblClick;
	}

	public void setLblClick(JButton lblClick) {
		this.lblClick = lblClick;
	}

	public JButton getLblClick_1() {
		return lblClick_1;
	}

	public void setLblClick_1(JButton lblClick_1) {
		this.lblClick_1 = lblClick_1;
	}

	public JButton getBtnApplyFilter() {
		return btnApplyFilter;
	}

	public void setBtnApplyFilter(JButton btnApplyFilter) {
		this.btnApplyFilter = btnApplyFilter;
	}

	public JComboBox getSellercomboBox() {
		return sellercomboBox;
	}
	public void setSellercomboBox(JComboBox sellercomboBox) {
		this.sellercomboBox = sellercomboBox;
	}
	public JTable getTable() {
		return table;
	}
	public void setTable(JTable table) {
		this.table = table;
	}
	public void actionlisteners(ActionListener al)
	{
		this.btnApplyFilter.addActionListener(al);
	}
}
